{% extends "base.html" %}

{% block title %}Strona główna {% endblock %}

{%block content%}
<h2>PenTester - services</h2>
<p>
{% if hostservlist %}
<h3>Currently scanned hosts in database</h3>
 The following list of hosts and services would be tested for vulnerabilities:<br>
 
 <form id="services_select" action="/services/update/" method="POST">
 {% for hserv in hostservlist %}
    <b>{{ hserv.address }}</b> <a href="/deletehost/{{ hserv.id }}">[Delete]</a>:<br>
    {% if hserv.services %} 
        {% for service in hserv.services %}
            {# [{{ service.id }}] #}
            <input type="checkbox" name="service{{ service.id }}" {% ifequal service.state 'up' %} checked {% endifequal %}> 
            {{ service.name }}({{service.port}})<br>
        {% endfor %} <br>
    {% endif %}
    
 {% endfor %}
 <input type="submit" value="Update list">
 </form>
 <br/>
 
 <h3>Add service to list:</h3>
 
 {# adding host #}
 <form id="add_to_host_{{ hserv.id }}" action="/services/add/" method="POST">
 <label for="hostselect">Host</label>
 <select name="host" id="hostselect">
 {% for host in hostservlist %}
    <option value="{{ host.id }}">{{host.address}}</option>
 {% endfor %}
 </select>
     <label for="txtAddPort">Port</label>
     <input type="text" id="txtAddPort" size="4" name="portnumber">
     <select name="protocol">
      <option value="tcp">TCP</option>
      <option value="udp">UDP</option>
     </select>
     <label for="txtAddPortDesc">Description</label>
     <input type="text" id="txtAddPortDesc" name="portdesc">
     <input type="submit" value="Add">
 </form>
 
 <p id="expl_par">
 	<a id="explstart" href="/exploit">Start exploitation!</a>
 </p>
{% endif %}  
</p> 
 {% endblock %}

{% block box %}
{% endblock %}
